#include<iostream>
#include<string>
using namespace std;
int n;
int main()
{
	cin >> n;
	string s;
	cin >> s;
	int ans = 0;
	while (s.find("fyt") != -1) {
		ans++;
		int pos = s.find("fyt");
		s = s.substr(pos+3);
	}
	cout << ans << endl;
	return 0;
}